package ncs.common.model;

/**
 * @author Jian
 * 用户登录到系统，每个用户Session中保存着这一个SessionStore用户标识用户身份
 *
 */
public class SessionStore {
	private User user;			//当前登录用户信息
	private String userName;		//当前登录用户名
	private int course_id;		//当前所选择的课程
	public SessionStore()
	{
		
	}
	public SessionStore(User user, String name) {
		this.user = user;
		this.userName = name;
	}
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public int getCourse_id() {
		return course_id;
	}
	public void setCourse_id(int course_id) {
		this.course_id = course_id;
	}
	public static SessionStore createAdmin()
	{
		SessionStore s=new SessionStore();
		User user=new User();
		user.setAuthority(0);
		user.setDbID(3);
		s.setUser(user);
		s.setUserName("jian");
		s.setCourse_id(-1);
		return s;
	}
	public static SessionStore createTeacher()
	{
		SessionStore s=new SessionStore();
		User user=new User();
		user.setAuthority(2);
		user.setDbID(4);
		s.setUser(user);
		s.setUserName("老师");
		s.setCourse_id(2);
		return s;
	}
	public static SessionStore createStudent()
	{
		SessionStore s=new SessionStore();
		User user=new User();
		user.setAuthority(3);
		user.setDbID(3);
		s.setUser(user);
		s.setUserName("郑剑峰");
		s.setCourse_id(2);
		return s;
	}
}
